capture clear all
capture log close
set more off
set mem 2000m
set maxvar 10000


cd "Replication data and files\"

use "National data for figures", clear

global grfont "Georgia"

gen deflator1=deflator/100
drop deflator
ren deflator1 deflator

gen primary_gdp_real=primary_gdp/deflator/1000
gen secondary_gdp_real=secondary_gdp/deflator/1000
gen tertiary_gdp_real=tertiary_gdp/deflator/1000

label var primary_gdp_real "Primary GDP"
label var secondary_gdp_real "Secondary GDP"
label var tertiary_gdp_real "Tertiary GDP"

gen primary_emp1=primary_emp/100
gen secondary_emp1=secondary_emp/100
gen tertiary_emp1=tertiary_emp/100

drop primary_emp secondary_emp tertiary_emp
ren primary_emp1 primary_emp
ren secondary_emp1 secondary_emp
ren tertiary_emp1 tertiary_emp

label var primary_emp "Primary employment"
label var secondary_emp "Secondary employment"
label var tertiary_emp "Tertiary employment"


twoway line primary_gdp_real year if year>1989, lwidth(thick) lpattern(solid) lcolor(black) /// 
    || line secondary_gdp_real year if year>1989, lwidth(thick) lpattern(dash_dot) lcolor(gs5)  ///
	|| line tertiary_gdp_real year if year>1989, lwidth(thick) lpattern(longdash) lcolor(gs10)  ///
legend(rows(3) symxsize(9) size(3)) xlabel(1990(5)2015, nogrid labsize(3))   ysize(3.5) ///
xsize(5) ylabel(, grid gmax angle(horizontal) labsize(3)) xtitle("") ytitle("GDP (Billions of 2000 Yuan)")  title("", color(black) size(3.5)) ///
title("", size(3.5) color(black)) xline(2002, lcolor(gray) lpattern(dash))
graph export "Output\GDP.png", replace



twoway line primary_emp year if year>1989, lwidth(thick) lpattern(solid) lcolor(black) /// 
    || line secondary_emp year if year>1989, lwidth(thick) lpattern(dash_dot) lcolor(gs5)  ///
	|| line tertiary_emp year if year>1989, lwidth(thick) lpattern(longdash) lcolor(gs10)  ///
legend(rows(3) symxsize(9) size(3)) xlabel(1990(5)2015, nogrid labsize(3)) ysize(3.5) ///
xsize(5) ylabel(, grid gmax angle(horizontal) labsize(3)) xtitle("") ytitle("Employment (Millions of Persons)")  title("", color(black) size(3.5)) ///
title("", size(3.5) color(black)) xline(2002, lcolor(gray) lpattern(dash))
graph export "Output\Employment.png", replace



use "Export data for figures", clear



twoway line exports_real year if year>1989, lwidth(thick) lpattern(solid) lcolor(black) yaxis(1) xaxis(1) /// 
    legend(off) xlabel(1990(5)2015, labsize(3)) ysize(3.5) ///
xsize(5) ylabel(, grid gmax angle(horizontal) labsize(3)) xtitle("") ytitle("Export Value to the United States (Billions of 2009 $)")  title("", color(black) size(3.5)) ///
 title("", size(3.5) color(black)) xline(2002, lcolor(gray) lpattern(dash))
graph export "Output\Figure_exports_a.png", replace


twoway line exports_total_real year, lwidth(thick) lpattern(solid) lcolor(black)  /// 
    legend(off) xlabel(1980(5)2015, labsize(3)) ysize(3.5) ///
xsize(5) ylabel(, grid gmax angle(horizontal) labsize(3)) xtitle("") ytitle("Export Value (Billions of 2009 U.S. $)")  title("", color(black) size(3.5)) ///
 title("", size(3.5) color(black)) xline(2002, lcolor(gray) lpattern(dash))
graph export "Output\Figure_exports_b.png", replace




use "Tariff data for figures", clear


graph twoway  (line us year, lwidth(thick) lpattern(solid) lcolor(black)) (line eu year, lwidth(thick) lpattern(dash_dot) lcolor(gs5)) (line japan year, lwidth(thick) lpattern(longdash) lcolor(gs8)) (line korea year , lwidth(thick) lpattern(shortdash) lcolor(gs11)) (line taiwan year, lwidth(thick) lcolor(gs14)), ///
legend(rows(4) symxsize(9) size(3)) xlabel(1996(2)2014, nogrid labsize(3)) ysize(3.5) ///
xsize(5) ylabel(, grid gmax angle(horizontal) labsize(3)) xtitle("") ytitle("Tariff rate") title("", color(black) size(3.5)) xline(2002, lcolor(gray) lpattern(dash))
graph export "Output\Export_tariffs.png",   replace



graph twoway  (line china_tariff year, lwidth(thick) lpattern(solid) lcolor(black)), ///
legend(rows(4) symxsize(9) size(3)) xlabel(1996(2)2014, nogrid labsize(3)) ysize(3.5) ///
xsize(5) ylabel(, grid gmax angle(horizontal) labsize(3)) xtitle("") ytitle("Domestic tariff rate") title("", color(black) size(3.5)) xline(2002, lcolor(gray) lpattern(dash))
graph export "Output\Domestic_tariff.png",   replace




